#include <stdio.h>

static int is_prime(int x)
{
    if (x <= 1) return 0;
    if (x == 2) return 1;
    if (x % 2 == 0) return 0;
    for (int i = 3; i <= x / i; i += 2) {
        if (x % i == 0) return 0;
    }
    return 1;
}

int main(void)
{
    int n;
    if (scanf("%d", &n) != 1) {
        return 0;
    }

    int found = 0;
    for (int i = 2; i <= n; ++i) {
        if (i % 10 != 1) continue;
        if (is_prime(i)) {
            if (found) printf(" ");
            printf("%d", i);
            found = 1;
        }
    }

    if (!found) {
        printf("-1");
    }
    return 0;
}